﻿<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="SimpleSMS.aspx.cs" Inherits="Customer_Profile.CRM.SimpleSMS" %>
<%@ Register assembly="DevExpress.Web.ASPxGridView.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxGridView" tagprefix="dx" %>
<%@ Register assembly="DevExpress.Web.ASPxEditors.v9.3, Version=9.3.3.0, Culture=neutral, PublicKeyToken=b88d1754d700e49a" namespace="DevExpress.Web.ASPxEditors" tagprefix="dx" %>
<%@ Register Src="~/mainTop.ascx" TagName="mainTop" TagPrefix="uc1" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>Customer List</title>
    <meta content="Microsoft Visual Studio .NET 7.1" name="GENERATOR" />
    <meta content="C#" name="CODE_LANGUAGE" />
    <meta content="JavaScript" name="vs_defaultClientScript" />
    <meta content="http://schemas.microsoft.com/intellisense/ie5" name="vs_targetSchema" />
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <link href="/css/style.css" type="text/css" rel="stylesheet" />
    <script language="javascript" type="text/javascript" src="/js/common.js"></script>
    <script language="javascript" type="text/javascript" src="/js/combox.js"></script>
    <script language="javascript" type="text/javascript" src="/js/CalPopUp.js"></script>
    <script language="javascript" type="text/javascript">
        function grid_SelectionChanged(s, e) {
            s.GetSelectedFieldValues("phone", GetSelectedFieldValuesCallback);
        }
        function GetSelectedFieldValuesCallback(values) {
            
            var extent_dealno = "";
            var reward_amount = 0;

            try {
                for (var i = 0; i < values.length; i++) {
                    var valueTemp = new Array();
                    valueTemp = values[i].toString().split(",");
                    extent_dealno += valueTemp[0] + ",";
                    //reward_amount = Number(reward_amount) + Number(valueTemp[1]) + Number(valueTemp[2])
                }
            } finally {
            }
            //alert(reward_amount);
            var hiddealno = document.getElementById("hidDealno");
            hiddealno.value = extent_dealno;
            //var reward_amount_txt = document.getElementById("txtSumAmount");
            //reward_amount_txt.value = formatFloat(reward_amount, 2);
        }

        function check_all() {

            var txtTitle = document.getElementById("txtTitle").value;
            if (txtTitle == '') {
                alert("标题不能为空！");
                return false;
            }

            var txtContent = document.getElementById("txtContent").value;            
            if (txtContent == '') {
                alert("短信内容不能为空！");
                return false;
            }

            
            if (txtContent.length > 85) {
                alert("短信内容不能超过85个字！");
                return false;
            }

            return confirm("你确认要为复核条件的所有客户发送短信吗?");
        }

        function check_select() {
            var hiddealno = document.getElementById("hidDealno");
            var strdealno = hiddealno.value;
            if (strdealno == '') {
                alert("请至少选择一个客户进行短信发送");
                return false;
            }
            var txtTitle = document.getElementById("txtTitle").value;
            if (txtTitle == '') {
                alert("标题不能为空！");
                return false;
            }

            var txtContent = document.getElementById("txtContent").value;
            if (txtContent == '') {
                alert("短信内容不能为空！");
                return false;
            }

            if (txtContent.length > 85) {
                alert("短信内容不能超过85个字！");
                return false;
            }

            return confirm("你确认要为选中的客户发送短信吗?");
       }

       function check_special() {

           var txtTitle = document.getElementById("txtTitle").value;
           if (txtTitle == '') {
               alert("标题不能为空！");
               return false;
           }

           var txtContent = document.getElementById("txtContent").value;
           if (txtContent == '') {
               alert("短信内容不能为空！");
               return false;
           }

           if (txtContent.length > 85) {
               alert("短信内容不能超过85个字！");
               return false;
           }

           var txtPhoneno = document.getElementById("txtPhoneno").value;
           if (txtPhoneno == '') {
               alert("手机号码不能为空！");
               return false;
           }
                      
           if (txtPhoneno.substring(txtPhoneno.length - 1, txtPhoneno.length) == ';') {
               alert("手机号码不能以分号结尾！");
               return false;
           }

           return confirm("你确认要为指定手机号码发送短信吗?");
       }

        function checkForm() {
            var start_date = document.getElementById("txtcreatedatebegin").value;
            var end_date = document.getElementById("txtcreatedateend").value;

            if (trim(start_date) != '' && trim(end_date) != '') {
                if (!strDateTime(start_date)) {
                    alert('起始日期格式不准确');
                    return false;
                }
                if (!strDateTime(end_date)) {
                    alert('结束日期格式不准确');
                    return false;
                }
            }
            return true;
        }

    </script>
</head>
<body>
    <form id="form1" runat="server">    
    <table height="100%" cellspacing="0" cellpadding="0" width="100%" border="0">
        <tr>
            <td width="1" background="/images/dot_vline.gif">
                <img height="1" src="/images/spacer.gif" width="1"></td>
            <td valign="top" width="15">
                <img height="1" src="/images/spacer.gif" width="15"></td>
            <td valign="top">
                <table cellspacing="0" cellpadding="0" width="100%" border="0">
                    <tr>
                        <td style="height: 23px">
                            <uc1:mainTop ID="MainTop1" runat="server" />
                            <span class="navi-blu"><span class="navi-blk">首页 &gt; 个人旅行卡管理 &gt; CRM &gt; 短信群发</span>
                            </span>
                        </td>
                    </tr>
                    <tr>
                        <td background="/images/dot_hline.gif">
                            <img height="1" src="/images/spacer.gif" width="1"></td>
                    </tr>
                </table>
                <table style="position: relative; top: 6px" cellspacing="0" cellpadding="0" width="100%"
                    border="0">
                    <tr>
                        <td>
                            <img height="6" src="/images/corner_lft1.gif" width="6"></td>
                        <td>
                            <div align="right">
                                <img height="6" src="/images/corner_rgt1.gif" width="6"></div>
                        </td>
                    </tr>
                </table>
                <table cellspacing="1" cellpadding="4" width="100%" bgcolor="#c8c8c8" border="0">                        
                    <tr bgcolor="#e9e9e9">                        
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td width="80">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">产品名称：</td>
                                    <td>
                                       <dx:ASPxDropDownEdit ClientInstanceName="checkComboBox" ID="ASPxDropDownEdit1" 
                                                SkinID="CheckComboBox" Width="220px" runat="server" EnableAnimation="False" ReadOnly="True">
                                                <DropDownWindowTemplate>
                                                    <dx:ASPxListBox Width="100%" Height="300px" ID="listBox" ClientInstanceName="checkListBox" SelectionMode="CheckColumn" runat="server"  SkinID="CheckComboBoxListBox">
                                                    <ClientSideEvents SelectedIndexChanged="OnListBoxSelectionChanged" />
                                                    </dx:ASPxListBox>
                                                    <table style="width:100%"><tr><td align="right">
                                                        <dx:ASPxButton ID="ASPxButton1" AutoPostBack="False" runat="server" Text="Close">
                                                            <ClientSideEvents Click="function(s, e){ checkComboBox.HideDropDown(); }"/>
                                                        </dx:ASPxButton>
                                                    </td></tr></table>
                                                </DropDownWindowTemplate>
                                                <ClientSideEvents TextChanged="SynchronizeListBoxValues" DropDown="SynchronizeListBoxValues" />
                                           </dx:ASPxDropDownEdit>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td  width="80">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">金额区间：</td>
                                    <td>
                                        <asp:TextBox ID="amount_start" runat="server" CssClass="input2" Width="120px"></asp:TextBox>
                                        ~
                                        <asp:TextBox ID="amount_end" runat="server" CssClass="input2" Width="120px"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td width="80">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">地区：</td>
                                    <td>
                                        <asp:DropDownList ID="dropEntity" runat="server" >
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td rowspan="2">
                            <div align="center">
                                <asp:Button ID="btnSearch" runat="server" Text="搜索" class="button" onclientclick="return checkForm()" onclick="btnSearch_Click" />                                
                            </div>
                        </td>
                    </tr>
                    <tr bgcolor="#e9e9e9">
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td  width="80">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">起息日：</td>
                                    <td>                                        
                                        <asp:TextBox ID="txtcreatedatebegin" runat="server" CssClass="input2" Width="80px"></asp:TextBox>
                                        <img style="cursor: hand" onclick="JavaScript:calPopForCMon(txtcreatedatebegin, 'ss');"
                                            height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                                        ~
                                        <asp:TextBox ID="txtcreatedateend" runat="server" CssClass="input2" Width="80px"></asp:TextBox>
                                        <img style="cursor: hand" onclick="JavaScript:calPopForCMon(txtcreatedateend, 'ss');"
                                            height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td  width="80">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">到期日：</td>
                                    <td>                                        
                                        <asp:TextBox ID="due_date_start" runat="server" CssClass="input2" Width="80px"></asp:TextBox>
                                        <img style="cursor: hand" onclick="JavaScript:calPopForCMon(due_date_start, 'ss');"
                                            height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                                        ~
                                        <asp:TextBox ID="due_date_end" runat="server" CssClass="input2" Width="80px"></asp:TextBox>
                                        <img style="cursor: hand" onclick="JavaScript:calPopForCMon(due_date_end, 'ss');"
                                            height="14" src="/images/dot_date.gif" width="16" align="absMiddle">
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td  width="80">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="absMiddle">客户性质：</td>
                                    <td>
                                        <asp:DropDownList ID="dropCpartyCatalog" runat="server" >
                                        </asp:DropDownList>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                </table>
                <table style="position: relative; top: -6px" cellspacing="0" cellpadding="0" width="100%"
                    border="0">
                    <tr>
                        <td>
                            <img height="6" src="/images/corner_lft2.gif" width="6"></td>
                        <td>
                            <div align="right">
                                <img height="6" src="/images/corner_rgt2.gif" width="6"></div>
                        </td>
                    </tr>
                </table>
                <table bordercolor="#c2d2e2" cellspacing="0" cellpadding="2" width="100%" border="1">
                    <tr>
                        <td>
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td bgcolor="#1765a7">
                                        <img height="11" src="/images/pic_results.gif" width="61"></td>
                                </tr>
                            </table>
                            <dx:ASPxGridView ID="gridReward" runat="server" KeyFieldName="cparty_id" Width="100%"
                                CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css" 
                                CssPostfix="Office2003Blue">
                                <Images SpriteCssFilePath="~/App_Themes/Office2003Blue/{0}/sprite.css">
                                    <LoadingPanelOnStatusBar Url="~/App_Themes/Office2003Blue/GridView/gvLoadingOnStatusBar.gif">
                                    </LoadingPanelOnStatusBar>
                                    <LoadingPanel Url="~/App_Themes/Office2003Blue/GridView/Loading.gif">
                                    </LoadingPanel>
                                </Images>
                                <ImagesFilterControl>
                                    <LoadingPanel Url="~/App_Themes/Office2003Blue/Editors/Loading.gif">
                                    </LoadingPanel>
                                </ImagesFilterControl>
                                <Styles CssFilePath="~/App_Themes/Office2003Blue/{0}/styles.css" 
                                    CssPostfix="Office2003Blue">
                                    <Header ImageSpacing="5px" SortingImageSpacing="5px">
                                    </Header>
                                    <LoadingPanel ImageSpacing="10px">
                                    </LoadingPanel>
                                </Styles>
                                <StylesEditors>
                                    <ProgressBar Height="25px">
                                    </ProgressBar>
                                </StylesEditors>
                                <Columns>
                                    <dx:GridViewCommandColumn ShowSelectCheckbox="True" VisibleIndex="0">
                                        <HeaderTemplate>
                                             <input type="checkbox" onclick="gridReward.SelectAllRowsOnPage(this.checked);" title="Select/Unselect all rows on the page" />
                                         </HeaderTemplate>
                                         <HeaderStyle HorizontalAlign="Center" />
                                    </dx:GridViewCommandColumn>                                   
                                    <dx:GridViewDataColumn FieldName="cparty_id" VisibleIndex="1" Caption="客户编码" />
                                    <dx:GridViewDataColumn FieldName="cparty_name" VisibleIndex="2" Caption="客户姓名" />
                                    <dx:GridViewDataColumn FieldName="phone" VisibleIndex="3" Caption="客户电话" />
                                    <dx:GridViewDataColumn FieldName="id_type" VisibleIndex="4" Caption="证件类型" />
                                    <dx:GridViewDataColumn FieldName="id_no" VisibleIndex="5" Caption="证件号码" />
                                    <dx:GridViewDataColumn FieldName="entity" VisibleIndex="6" Caption="地区" />
                                    <dx:GridViewDataColumn FieldName="address" VisibleIndex="7" Caption="住址" />                                    
                                </Columns>
                                <ClientSideEvents SelectionChanged="grid_SelectionChanged" />                                
                            </dx:ASPxGridView>
                            <asp:HiddenField ID="hidDealno" runat="server" />
                        </td>
                    </tr>
                </table>
                <table cellspacing="0" cellpadding="0" width="100%" border="0">
                    <tr>
                        <td>
                            <img height="3" src="/images/spacer.gif" width="1"></td>
                    </tr>
                </table>
                <table cellspacing="1" cellpadding="4" width="100%" bgcolor="#c8c8c8" border="0">                        
                    <tr bgcolor="#e9e9e9">
                        <td colspan="2">
                            <table cellspacing="0" cellpadding="0" width="98%" border="0">
                                <tr>
                                    <td width="70">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="middle">标题：                                        
                                    </td>
                                    <td>
                                        <asp:TextBox ID="txtTitle" class="input2" runat="server" Width="100%"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>
                    <tr bgcolor="#e9e9e9">
                        <td width="50%">
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td width="70">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="middle">内容：</td>
                                    <td>
                                        <asp:TextBox ID="txtContent" Rows="5" MaxLength="70" class="input4"  TextMode="MultiLine" Width="96%"  runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                        <td width="50%">
                            <table cellspacing="0" cellpadding="0" width="100%" border="0">
                                <tr>
                                    <td width="70">
                                        <img height="9" hspace="5" src="/images/arw_gry_rgt.gif" width="9" align="middle">手机号：</td>
                                    <td>
                                       <asp:TextBox ID="txtPhoneno"  Rows="5" TextMode="MultiLine" class="input4"   Width="96%" runat="server"></asp:TextBox>
                                    </td>
                                </tr>
                            </table>
                        </td>
                    </tr>      
                    <tr  bgcolor="#e9e9e9">                        
                         <td colspan="2">
                            <div align="center">                                
                                <asp:Button ID="btnSubmitAll" runat="server" Text="全部发送" class="button" OnClientClick="return check_all();" onclick="btnSubmit_Click" />
                                <asp:Button ID="btnSubmitCheck" runat="server" Text="选择发送" class="button" 
                                    OnClientClick="return check_select();" onclick="btnSubmitCheck_Click"  />
                                <asp:Button ID="btnSubmitSpecial" runat="server" Text="指定发送" class="button" 
                                    OnClientClick="return check_special();" onclick="btnSubmitSpecial_Click" />
                            </div>
                        </td>
                    </tr>
                </table>
            </td>
            <td valign="top" width="10">
                <img height="1" alt="" src="/images/spacer.gif" width="10"></td>
        </tr>
    </table>
    </form>
</body>
<%=strScript %>
</html>